package com.buke66.taoduo.user.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.buke66.taoduo.user.entity.UserIntegrationChangeHistoryEntity;
import com.buke66.taoduo.user.service.UserIntegrationChangeHistoryService;
import com.buke66.taoduo.common.utils.PageUtils;
import com.buke66.taoduo.common.utils.R;



/**
 * 积分变化历史记录
 *
 * @author buke
 * @email 66482504@qq.com
 * @date 2021-10-06 14:20:45
 */
@RestController
@RequestMapping("user/userintegrationchangehistory")
public class UserIntegrationChangeHistoryController {
    @Autowired
    private UserIntegrationChangeHistoryService userIntegrationChangeHistoryService;

    /**
     * 列表
     */
    @RequestMapping("/list")
        public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userIntegrationChangeHistoryService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
        public R info(@PathVariable("id") Long id){
		UserIntegrationChangeHistoryEntity userIntegrationChangeHistory = userIntegrationChangeHistoryService.getById(id);

        return R.ok().put("userIntegrationChangeHistory", userIntegrationChangeHistory);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
        public R save(@RequestBody UserIntegrationChangeHistoryEntity userIntegrationChangeHistory){
		userIntegrationChangeHistoryService.save(userIntegrationChangeHistory);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
        public R update(@RequestBody UserIntegrationChangeHistoryEntity userIntegrationChangeHistory){
		userIntegrationChangeHistoryService.updateById(userIntegrationChangeHistory);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
        public R delete(@RequestBody Long[] ids){
		userIntegrationChangeHistoryService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
